package org.assistant.csp.domain;

import java.util.List;

import org.assistant.common.exception.GetFromDBException;
import org.assistant.common.exception.SaveIntoDBException;
import org.assistant.csp.data.RelationUser;
import org.assistant.csp.data.UserSession;

public interface UserDomain {
	/**
	 * 判断登录账号是否在系统中已经存在
	 * 
	 * @param loginAccount
	 * @return
	 * @throws GetFromDBException
	 */
	public boolean isLoginAccountExist(String loginAccount)
			throws GetFromDBException;

	/**
	 * 判断email在系统中是否已经存在
	 * 
	 * @param email
	 * @return
	 * @throws GetFromDBException
	 */
	public boolean isEmailExist(String email) throws GetFromDBException;

	/**
	 * 根据用户账号获取用户信息
	 * 
	 * @param loginAccount
	 * @return
	 * @throws GetFromDBException
	 */
	public UserSession getUserByLoginAccount(String loginAccount)
			throws GetFromDBException;

	/**
	 * 判断密码是否正确
	 * 
	 * @param loginZh
	 * @param password
	 * @return
	 * @throws GetFromDBException
	 */
	public boolean isPasswordCorrect(String loginZh, String password)
			throws GetFromDBException;

	/**
	 * 保存用户(注册)信息
	 * 
	 * @param userSession
	 *            -用户Session信息
	 * @param password
	 *            -密码
	 * @return UserSession
	 * @throws SaveIntoDBException
	 * @throws GetFromDBException
	 */
	public UserSession insertUser(UserSession userSession, String password)
			throws SaveIntoDBException, GetFromDBException;

	/**
	 * 根据ID获取关联用户信息
	 * 
	 * @param relationUserId
	 * @return
	 * @throws GetFromDBException
	 */
	public RelationUser getRelationUserById(String relationUserId)
			throws GetFromDBException;

	/**
	 * 根据家庭ID获取该家庭下的关联用户信息
	 * 
	 * @param homeId
	 * @return
	 * @throws GetFromDBException
	 */
	public List<RelationUser> getRelationUserByHome(String homeId)
			throws GetFromDBException;

	/**
	 * 保存关联用户信息
	 * 
	 * @param relationUser
	 * @throws SaveIntoDBException
	 */
	public void insertRelationUser(String name, String homeId)
			throws SaveIntoDBException;
}
